package com.un.web.topic.controller;

import com.un.core.common.R;
import com.un.core.utils.TokenUtils;
import com.un.web.topic.domian.entity.TopicUserTopic;
import com.un.web.topic.service.TopicUserTopicService;
import com.un.web.topic.service.impl.TopicUserTopicServiceImpl;
import org.springframework.web.bind.annotation.*;

import org.springframework.beans.factory.annotation.Autowired;

/**
 * (topic_user_topic)表控制层
 *
 * @author xxxxx
 */
@RestController
@RequestMapping("/topic_user_topic")
public class TopicUserTopicController {

    @Autowired
    private TopicUserTopicService topicUserTopicService;

    @RequestMapping("/answer")
    public R findAnswer(Integer topicId){
        TopicUserTopic topicUserTopic = new TopicUserTopic();
        topicUserTopic.setTopicId(topicId);
        Integer userId = TokenUtils.getUserId();
        topicUserTopic.setUserId(userId);
        topicUserTopicService.save(topicUserTopic);
        return R.success("");
    }

}
